#include "cpu/exec/template-start.h"

#define instr call

make_helper(concat(call_i_, SUFFIX)) {
    int len = concat(decode_i_, SUFFIX)(cpu.eip + 1);
    cpu.esp -= DATA_BYTE;
    swaddr_write(cpu.esp, 4, cpu.eip + len + 1,2);
    print_asm("call\t%x",cpu.eip + 1 + len + op_src->imm);
    cpu.eip += op_src->imm;
    return len + 1;
} 
 make_helper(concat(call_rm_, SUFFIX)){
    int len = concat(decode_rm_, SUFFIX)(cpu.eip + 1);
	reg_l(R_ESP) -= DATA_BYTE;
	swaddr_write(reg_l(R_ESP) , 4, cpu.eip + len + 1,2);
	DATA_TYPE_S disp = op_src -> val;
	print_asm("call %x",disp);
	cpu.eip = disp - len - 1;
	return len + 1;
}


#include "cpu/exec/template-end.h"